import Vue from 'vue'
import Vuex from 'vuex'
 import {reqAddress} from '../api/index'

Vue.use(Vuex);
import {BABY_SHOW} from './mutation-types'



export default new Vuex.Store({
  state: {
      babyList:[]
  },
  mutations: {

      [BABY_SHOW] (state, {data}) {
          state.babyList = data;
          console.log(state.babyList[0]["cover"])
      },
  },
  actions: {
   async getAddress({commit,state},sort) {
   var List=  await reqAddress(sort.sort);

   if(List.success){
       let data=List.data;
       commit(BABY_SHOW,{data})
   }
   else{
      alert(List.msg)
   }

      }

  }
})
